/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sicav.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author itca
 */
@Entity
@Table(name = "tdatos_persona")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TdatosPersona.findAll", query = "SELECT t FROM TdatosPersona t"),
    @NamedQuery(name = "TdatosPersona.findByCcodigo", query = "SELECT t FROM TdatosPersona t WHERE t.ccodigo = :ccodigo"),
    @NamedQuery(name = "TdatosPersona.findByNombre", query = "SELECT t FROM TdatosPersona t WHERE t.nombre = :nombre"),
    @NamedQuery(name = "TdatosPersona.findByDireccion", query = "SELECT t FROM TdatosPersona t WHERE t.direccion = :direccion"),
    @NamedQuery(name = "TdatosPersona.findByTelefono", query = "SELECT t FROM TdatosPersona t WHERE t.telefono = :telefono")})
public class TdatosPersona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ccodigo")
    private Integer ccodigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "direccion")
    private String direccion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "telefono")
    private String telefono;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "tdatosPersona")
    private Tsocio tsocio;

    public TdatosPersona() {
    }

    public TdatosPersona(Integer ccodigo) {
        this.ccodigo = ccodigo;
    }

    public TdatosPersona(Integer ccodigo, String nombre, String direccion, String telefono) {
        this.ccodigo = ccodigo;
        this.nombre = nombre;
        this.direccion = direccion;
        this.telefono = telefono;
    }

    public Integer getCcodigo() {
        return ccodigo;
    }

    public void setCcodigo(Integer ccodigo) {
        this.ccodigo = ccodigo;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public Tsocio getTsocio() {
        return tsocio;
    }

    public void setTsocio(Tsocio tsocio) {
        this.tsocio = tsocio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ccodigo != null ? ccodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TdatosPersona)) {
            return false;
        }
        TdatosPersona other = (TdatosPersona) object;
        if ((this.ccodigo == null && other.ccodigo != null) || (this.ccodigo != null && !this.ccodigo.equals(other.ccodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.sicav.entidades.TdatosPersona[ ccodigo=" + ccodigo + " ]";
    }
    
}
